/*
 Navicat Premium Data Transfer

 Source Server         : MySQL_local
 Source Server Type    : MySQL
 Source Server Version : 80031
 Source Host           : localhost:3306
 Source Schema         : autumn-mall

 Target Server Type    : SQL Server
 Target Server Version : 11000000
 File Encoding         : 65001

 Date: 22/06/2023 10:56:57
*/


-- ----------------------------
-- Table structure for t_meta_per_unit
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[autumn-mall].[t_meta_per_unit]') AND type IN ('U'))
	DROP TABLE [autumn-mall].[t_meta_per_unit]
GO

CREATE TABLE [t_meta_per_unit] (
  [id] nvarchar(64) NOT NULL,
  [code] nvarchar(50) NOT NULL,
  [name] nvarchar(50) NOT NULL,
  [is_enable] int NOT NULL,
  [is_delete] int NOT NULL,
  [remark] nvarchar(max) NULL,
  [create_by] nvarchar(64) NOT NULL,
  [create_name] nvarchar(50) NOT NULL,
  [create_time] datetime2(0) NOT NULL,
  [update_by] nvarchar(64) NULL,
  [update_name] nvarchar(50) NULL,
  [update_time] datetime2(0) NULL
)
GO

EXEC sp_addextendedproperty
'MS_Description', N'主键'
GO

EXEC sp_addextendedproperty
'MS_Description', N'单位标识'
GO

EXEC sp_addextendedproperty
'MS_Description', N'单位描述'
GO

EXEC sp_addextendedproperty
'MS_Description', N'是否启用(0-否 1-是)'
GO

EXEC sp_addextendedproperty
'MS_Description', N'删除标识(0-否 1-是)'
GO

EXEC sp_addextendedproperty
'MS_Description', N'备注'
GO

EXEC sp_addextendedproperty
'MS_Description', N'创建者'
GO

EXEC sp_addextendedproperty
'MS_Description', N'创建者姓名'
GO

EXEC sp_addextendedproperty
'MS_Description', N'创建时间'
GO

EXEC sp_addextendedproperty
'MS_Description', N'更新者'
GO

EXEC sp_addextendedproperty
'MS_Description', N'更新者姓名'
GO

EXEC sp_addextendedproperty
'MS_Description', N'更新时间'
GO

EXEC sp_addextendedproperty
'MS_Description', N'计量单位'
GO


-- ----------------------------
-- Records of t_meta_per_unit
-- ----------------------------

-- ----------------------------
-- Table structure for t_meta_product_category
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[autumn-mall].[t_meta_product_category]') AND type IN ('U'))
	DROP TABLE [autumn-mall].[t_meta_product_category]
GO

CREATE TABLE [t_meta_product_category] (
  [id] nvarchar(64) NOT NULL,
  [parent_id] nvarchar(64) NOT NULL,
  [parent_ids] nvarchar(1024) NOT NULL,
  [code] nvarchar(50) NOT NULL,
  [name] nvarchar(50) NOT NULL,
  [sort] int NOT NULL,
  [is_enable] int NOT NULL,
  [is_delete] int NOT NULL,
  [remark] nvarchar(max) NULL,
  [create_by] nvarchar(64) NOT NULL,
  [create_name] nvarchar(50) NOT NULL,
  [create_time] datetime2(0) NOT NULL,
  [update_by] nvarchar(64) NULL,
  [update_name] nvarchar(50) NULL,
  [update_time] datetime2(0) NULL
)
GO

EXEC sp_addextendedproperty
'MS_Description', N'主键'
GO

EXEC sp_addextendedproperty
'MS_Description', N'父级ID'
GO

EXEC sp_addextendedproperty
'MS_Description', N'所有父级ID'
GO

EXEC sp_addextendedproperty
'MS_Description', N'分类标识'
GO

EXEC sp_addextendedproperty
'MS_Description', N'分类描述'
GO

EXEC sp_addextendedproperty
'MS_Description', N'排序'
GO

EXEC sp_addextendedproperty
'MS_Description', N'是否启用(0-否 1-是)'
GO

EXEC sp_addextendedproperty
'MS_Description', N'删除标识(0-否 1-是)'
GO

EXEC sp_addextendedproperty
'MS_Description', N'备注'
GO

EXEC sp_addextendedproperty
'MS_Description', N'创建者'
GO

EXEC sp_addextendedproperty
'MS_Description', N'创建者姓名'
GO

EXEC sp_addextendedproperty
'MS_Description', N'创建时间'
GO

EXEC sp_addextendedproperty
'MS_Description', N'更新者'
GO

EXEC sp_addextendedproperty
'MS_Description', N'更新者姓名'
GO

EXEC sp_addextendedproperty
'MS_Description', N'更新时间'
GO

EXEC sp_addextendedproperty
'MS_Description', N'商品分类'
GO


-- ----------------------------
-- Records of t_meta_product_category
-- ----------------------------

-- ----------------------------
-- Table structure for t_meta_product_info
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[autumn-mall].[t_meta_product_info]') AND type IN ('U'))
	DROP TABLE [autumn-mall].[t_meta_product_info]
GO

CREATE TABLE [t_meta_product_info] (
  [id] nvarchar(64) NOT NULL,
  [category] nvarchar(64) NOT NULL,
  [code] nvarchar(50) NOT NULL,
  [name] nvarchar(50) NOT NULL,
  [spec] nvarchar(100) NOT NULL,
  [model] nvarchar(100) NOT NULL,
  [cover_img] nvarchar(64) NOT NULL,
  [unit] nvarchar(64) NOT NULL,
  [unit_price] decimal(10,2) NOT NULL,
  [is_enable] int NOT NULL,
  [is_delete] int NOT NULL,
  [remark] nvarchar(max) NULL,
  [create_by] nvarchar(64) NOT NULL,
  [create_name] nvarchar(50) NOT NULL,
  [create_time] datetime2(0) NOT NULL,
  [update_by] nvarchar(64) NULL,
  [update_name] nvarchar(50) NULL,
  [update_time] datetime2(0) NULL
)
GO

EXEC sp_addextendedproperty
'MS_Description', N'主键'
GO

EXEC sp_addextendedproperty
'MS_Description', N'商品分类'
GO

EXEC sp_addextendedproperty
'MS_Description', N'商品编码'
GO

EXEC sp_addextendedproperty
'MS_Description', N'商品描述'
GO

EXEC sp_addextendedproperty
'MS_Description', N'商品规格'
GO

EXEC sp_addextendedproperty
'MS_Description', N'商品型号'
GO

EXEC sp_addextendedproperty
'MS_Description', N'商品封面'
GO

EXEC sp_addextendedproperty
'MS_Description', N'商品单位'
GO

EXEC sp_addextendedproperty
'MS_Description', N'单价'
GO

EXEC sp_addextendedproperty
'MS_Description', N'是否启用(0-否 1-是)'
GO

EXEC sp_addextendedproperty
'MS_Description', N'删除标识(0-否 1-是)'
GO

EXEC sp_addextendedproperty
'MS_Description', N'商品简介'
GO

EXEC sp_addextendedproperty
'MS_Description', N'创建者'
GO

EXEC sp_addextendedproperty
'MS_Description', N'创建者姓名'
GO

EXEC sp_addextendedproperty
'MS_Description', N'创建时间'
GO

EXEC sp_addextendedproperty
'MS_Description', N'更新者'
GO

EXEC sp_addextendedproperty
'MS_Description', N'更新者姓名'
GO

EXEC sp_addextendedproperty
'MS_Description', N'更新时间'
GO

EXEC sp_addextendedproperty
'MS_Description', N'商品信息'
GO


-- ----------------------------
-- Records of t_meta_product_info
-- ----------------------------

-- ----------------------------
-- Table structure for t_sale_sale_order
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[autumn-mall].[t_sale_sale_order]') AND type IN ('U'))
	DROP TABLE [autumn-mall].[t_sale_sale_order]
GO

CREATE TABLE [t_sale_sale_order] (
  [id] nvarchar(64) NOT NULL,
  [order_no] nvarchar(100) NOT NULL,
  [contact] nvarchar(50) NOT NULL,
  [area_code] nvarchar(20) NOT NULL,
  [address] nvarchar(200) NOT NULL,
  [email] nvarchar(100) NOT NULL,
  [phone] nvarchar(15) NOT NULL,
  [longitude] nvarchar(15) NOT NULL,
  [latitude] nvarchar(15) NOT NULL,
  [status] int NOT NULL,
  [remark] nvarchar(max) NULL,
  [create_by] nvarchar(64) NOT NULL,
  [create_name] nvarchar(50) NOT NULL,
  [create_time] datetime2(0) NOT NULL,
  [update_by] nvarchar(64) NULL,
  [update_name] nvarchar(50) NULL,
  [update_time] datetime2(0) NULL
)
GO

EXEC sp_addextendedproperty
'MS_Description', N'主键'
GO

EXEC sp_addextendedproperty
'MS_Description', N'订单号'
GO

EXEC sp_addextendedproperty
'MS_Description', N'联系人'
GO

EXEC sp_addextendedproperty
'MS_Description', N'地区编码'
GO

EXEC sp_addextendedproperty
'MS_Description', N'常住地址'
GO

EXEC sp_addextendedproperty
'MS_Description', N'E-MAIL'
GO

EXEC sp_addextendedproperty
'MS_Description', N'联系方式'
GO

EXEC sp_addextendedproperty
'MS_Description', N'经度'
GO

EXEC sp_addextendedproperty
'MS_Description', N'纬度'
GO

EXEC sp_addextendedproperty
'MS_Description', N'状态(字典项-->SALE_STATUS)'
GO

EXEC sp_addextendedproperty
'MS_Description', N'备注'
GO

EXEC sp_addextendedproperty
'MS_Description', N'创建者'
GO

EXEC sp_addextendedproperty
'MS_Description', N'创建者姓名'
GO

EXEC sp_addextendedproperty
'MS_Description', N'创建时间'
GO

EXEC sp_addextendedproperty
'MS_Description', N'更新者'
GO

EXEC sp_addextendedproperty
'MS_Description', N'更新者姓名'
GO

EXEC sp_addextendedproperty
'MS_Description', N'更新时间'
GO

EXEC sp_addextendedproperty
'MS_Description', N'销售订单'
GO


-- ----------------------------
-- Records of t_sale_sale_order
-- ----------------------------

-- ----------------------------
-- Table structure for t_sale_sale_order_dtl
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[autumn-mall].[t_sale_sale_order_dtl]') AND type IN ('U'))
	DROP TABLE [autumn-mall].[t_sale_sale_order_dtl]
GO

CREATE TABLE [t_sale_sale_order_dtl] (
  [id] nvarchar(64) NOT NULL,
  [sale_order_id] nvarchar(64) NOT NULL,
  [product_id] nvarchar(64) NOT NULL,
  [product_category] nvarchar(50) NOT NULL,
  [product_code] nvarchar(50) NOT NULL,
  [product_name] nvarchar(100) NOT NULL,
  [product_spec] nvarchar(100) NOT NULL,
  [product_model] nvarchar(100) NOT NULL,
  [sale_qty] decimal(17,3) NOT NULL,
  [complete_qty] decimal(17,3) NOT NULL,
  [status] int NOT NULL,
  [remark] nvarchar(max) NULL,
  [create_by] nvarchar(64) NOT NULL,
  [create_name] nvarchar(50) NOT NULL,
  [create_time] datetime2(0) NOT NULL,
  [update_by] nvarchar(64) NULL,
  [update_name] nvarchar(50) NULL,
  [update_time] datetime2(0) NULL
)
GO

EXEC sp_addextendedproperty
'MS_Description', N'主键'
GO

EXEC sp_addextendedproperty
'MS_Description', N'销售订单'
GO

EXEC sp_addextendedproperty
'MS_Description', N'商品信息'
GO

EXEC sp_addextendedproperty
'MS_Description', N'商品分类'
GO

EXEC sp_addextendedproperty
'MS_Description', N'商品编号'
GO

EXEC sp_addextendedproperty
'MS_Description', N'商品名称'
GO

EXEC sp_addextendedproperty
'MS_Description', N'商品规格'
GO

EXEC sp_addextendedproperty
'MS_Description', N'商品型号'
GO

EXEC sp_addextendedproperty
'MS_Description', N'销售数量'
GO

EXEC sp_addextendedproperty
'MS_Description', N'完成数量'
GO

EXEC sp_addextendedproperty
'MS_Description', N'状态(字典项-->SALE_STATUS)'
GO

EXEC sp_addextendedproperty
'MS_Description', N'备注'
GO

EXEC sp_addextendedproperty
'MS_Description', N'创建者'
GO

EXEC sp_addextendedproperty
'MS_Description', N'创建者姓名'
GO

EXEC sp_addextendedproperty
'MS_Description', N'创建时间'
GO

EXEC sp_addextendedproperty
'MS_Description', N'更新者'
GO

EXEC sp_addextendedproperty
'MS_Description', N'更新者姓名'
GO

EXEC sp_addextendedproperty
'MS_Description', N'更新时间'
GO

EXEC sp_addextendedproperty
'MS_Description', N'销售订单明细'
GO


-- ----------------------------
-- Records of t_sale_sale_order_dtl
-- ----------------------------

-- ----------------------------
-- Table structure for t_wms_stock
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[autumn-mall].[t_wms_stock]') AND type IN ('U'))
	DROP TABLE [autumn-mall].[t_wms_stock]
GO

CREATE TABLE [t_wms_stock] (
  [id] nvarchar(64) NOT NULL,
  [warehouse_info_id] nvarchar(64) NOT NULL,
  [warehouse_info_code] nvarchar(50) NOT NULL,
  [warehouse_info_name] nvarchar(100) NOT NULL,
  [warehouse_area_id] nvarchar(64) NOT NULL,
  [warehouse_area_code] nvarchar(50) NOT NULL,
  [warehouse_area_name] nvarchar(100) NOT NULL,
  [warehouse_location_id] nvarchar(64) NOT NULL,
  [warehouse_location_code] nvarchar(50) NOT NULL,
  [warehouse_location_name] nvarchar(100) NOT NULL,
  [warehouse_category] nvarchar(10) NOT NULL,
  [warehouse_property] nvarchar(10) NOT NULL,
  [stock_qty] decimal(17,3) NOT NULL,
  [occupied_qty] decimal(17,3) NOT NULL,
  [remark] nvarchar(max) NULL,
  [create_by] nvarchar(64) NOT NULL,
  [create_name] nvarchar(50) NOT NULL,
  [create_time] datetime2(0) NOT NULL,
  [update_by] nvarchar(64) NULL,
  [update_name] nvarchar(50) NULL,
  [update_time] datetime2(0) NULL
)
GO

EXEC sp_addextendedproperty
'MS_Description', N'主键'
GO

EXEC sp_addextendedproperty
'MS_Description', N'所属仓库'
GO

EXEC sp_addextendedproperty
'MS_Description', N'仓库编码'
GO

EXEC sp_addextendedproperty
'MS_Description', N'仓库名称'
GO

EXEC sp_addextendedproperty
'MS_Description', N'所属库区'
GO

EXEC sp_addextendedproperty
'MS_Description', N'库区编码'
GO

EXEC sp_addextendedproperty
'MS_Description', N'库区名称'
GO

EXEC sp_addextendedproperty
'MS_Description', N'所属库位'
GO

EXEC sp_addextendedproperty
'MS_Description', N'库位编码'
GO

EXEC sp_addextendedproperty
'MS_Description', N'库位描述'
GO

EXEC sp_addextendedproperty
'MS_Description', N'仓库分类（字典项-->warehouse_category）'
GO

EXEC sp_addextendedproperty
'MS_Description', N'仓库属性（字典项-->warehouse_property，-1-不合格 0-待验 1-合格）'
GO

EXEC sp_addextendedproperty
'MS_Description', N'库存数量'
GO

EXEC sp_addextendedproperty
'MS_Description', N'占用数量'
GO

EXEC sp_addextendedproperty
'MS_Description', N'备注'
GO

EXEC sp_addextendedproperty
'MS_Description', N'创建者'
GO

EXEC sp_addextendedproperty
'MS_Description', N'创建者姓名'
GO

EXEC sp_addextendedproperty
'MS_Description', N'创建时间'
GO

EXEC sp_addextendedproperty
'MS_Description', N'更新者'
GO

EXEC sp_addextendedproperty
'MS_Description', N'更新者姓名'
GO

EXEC sp_addextendedproperty
'MS_Description', N'更新时间'
GO

EXEC sp_addextendedproperty
'MS_Description', N'库存信息'
GO


-- ----------------------------
-- Records of t_wms_stock
-- ----------------------------

-- ----------------------------
-- Table structure for t_wms_stock_dtl
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[autumn-mall].[t_wms_stock_dtl]') AND type IN ('U'))
	DROP TABLE [autumn-mall].[t_wms_stock_dtl]
GO

CREATE TABLE [t_wms_stock_dtl] (
  [id] nvarchar(64) NOT NULL,
  [warehouse_stock_id] nvarchar(64) NOT NULL,
  [product_id] nvarchar(64) NOT NULL,
  [product_category] nvarchar(50) NOT NULL,
  [product_code] nvarchar(50) NOT NULL,
  [product_name] nvarchar(100) NOT NULL,
  [product_spec] nvarchar(100) NOT NULL,
  [product_model] nvarchar(100) NOT NULL,
  [product_unit] nvarchar(64) NOT NULL,
  [batch_no] nvarchar(50) NOT NULL,
  [custom_batch_no] nvarchar(50) NOT NULL,
  [sn_no] nvarchar(100) NOT NULL,
  [stock_qty] decimal(17,3) NOT NULL,
  [occupied_qty] decimal(17,3) NOT NULL,
  [remark] nvarchar(max) NULL,
  [create_by] nvarchar(64) NOT NULL,
  [create_name] nvarchar(50) NOT NULL,
  [create_time] datetime2(0) NOT NULL,
  [update_by] nvarchar(64) NULL,
  [update_name] nvarchar(50) NULL,
  [update_time] datetime2(0) NULL
)
GO

EXEC sp_addextendedproperty
'MS_Description', N'主键'
GO

EXEC sp_addextendedproperty
'MS_Description', N'库存信息'
GO

EXEC sp_addextendedproperty
'MS_Description', N'商品信息'
GO

EXEC sp_addextendedproperty
'MS_Description', N'商品分类'
GO

EXEC sp_addextendedproperty
'MS_Description', N'商品编号'
GO

EXEC sp_addextendedproperty
'MS_Description', N'商品名称'
GO

EXEC sp_addextendedproperty
'MS_Description', N'商品规格'
GO

EXEC sp_addextendedproperty
'MS_Description', N'商品型号'
GO

EXEC sp_addextendedproperty
'MS_Description', N'商品单位'
GO

EXEC sp_addextendedproperty
'MS_Description', N'商品批号'
GO

EXEC sp_addextendedproperty
'MS_Description', N'客户批号'
GO

EXEC sp_addextendedproperty
'MS_Description', N'商品条码'
GO

EXEC sp_addextendedproperty
'MS_Description', N'库存数量'
GO

EXEC sp_addextendedproperty
'MS_Description', N'占用数量'
GO

EXEC sp_addextendedproperty
'MS_Description', N'备注'
GO

EXEC sp_addextendedproperty
'MS_Description', N'创建者'
GO

EXEC sp_addextendedproperty
'MS_Description', N'创建者姓名'
GO

EXEC sp_addextendedproperty
'MS_Description', N'创建时间'
GO

EXEC sp_addextendedproperty
'MS_Description', N'更新者'
GO

EXEC sp_addextendedproperty
'MS_Description', N'更新者姓名'
GO

EXEC sp_addextendedproperty
'MS_Description', N'更新时间'
GO

EXEC sp_addextendedproperty
'MS_Description', N'库存明细'
GO


-- ----------------------------
-- Records of t_wms_stock_dtl
-- ----------------------------

-- ----------------------------
-- Table structure for t_wms_stock_log
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[autumn-mall].[t_wms_stock_log]') AND type IN ('U'))
	DROP TABLE [autumn-mall].[t_wms_stock_log]
GO

CREATE TABLE [t_wms_stock_log] (
  [id] nvarchar(64) NOT NULL,
  [from_warehouse_info_id] nvarchar(64) NOT NULL,
  [from_warehouse_info_code] nvarchar(50) NOT NULL,
  [from_warehouse_info_name] nvarchar(100) NOT NULL,
  [from_warehouse_area_id] nvarchar(64) NOT NULL,
  [from_warehouse_area_code] nvarchar(50) NOT NULL,
  [from_warehouse_area_name] nvarchar(100) NOT NULL,
  [from_warehouse_location_id] nvarchar(64) NOT NULL,
  [from_warehouse_location_code] nvarchar(50) NOT NULL,
  [from_warehouse_location_name] nvarchar(100) NOT NULL,
  [from_warehouse_category] nvarchar(10) NOT NULL,
  [from_warehouse_property] nvarchar(10) NOT NULL,
  [to_warehouse_info_id] nvarchar(64) NOT NULL,
  [to_warehouse_info_code] nvarchar(50) NOT NULL,
  [to_warehouse_info_name] nvarchar(100) NOT NULL,
  [to_warehouse_area_id] nvarchar(64) NOT NULL,
  [to_warehouse_area_code] nvarchar(50) NOT NULL,
  [to_warehouse_area_name] nvarchar(100) NOT NULL,
  [to_warehouse_location_id] nvarchar(64) NOT NULL,
  [to_warehouse_location_code] nvarchar(50) NOT NULL,
  [to_warehouse_location_name] nvarchar(100) NOT NULL,
  [to_warehouse_category] nvarchar(10) NOT NULL,
  [to_warehouse_property] nvarchar(10) NOT NULL,
  [action_type] int NOT NULL,
  [product_id] nvarchar(64) NOT NULL,
  [product_category] nvarchar(50) NOT NULL,
  [product_code] nvarchar(50) NOT NULL,
  [product_name] nvarchar(100) NOT NULL,
  [product_spec] nvarchar(100) NOT NULL,
  [product_model] nvarchar(100) NOT NULL,
  [product_unit] nvarchar(64) NOT NULL,
  [batch_no] nvarchar(50) NOT NULL,
  [sn_no] nvarchar(100) NOT NULL,
  [stock_qty] decimal(17,3) NOT NULL,
  [source_order_no] nvarchar(100) NOT NULL,
  [business_order_no] nvarchar(100) NOT NULL,
  [business_type] nvarchar(10) NOT NULL,
  [remark] nvarchar(max) NULL,
  [create_by] nvarchar(64) NOT NULL,
  [create_name] nvarchar(50) NOT NULL,
  [create_time] datetime2(0) NOT NULL,
  [update_by] nvarchar(64) NULL,
  [update_name] nvarchar(50) NULL,
  [update_time] datetime2(0) NULL
)
GO

EXEC sp_addextendedproperty
'MS_Description', N'主键'
GO

EXEC sp_addextendedproperty
'MS_Description', N'来源仓库'
GO

EXEC sp_addextendedproperty
'MS_Description', N'来源仓库编码'
GO

EXEC sp_addextendedproperty
'MS_Description', N'来源仓库名称'
GO

EXEC sp_addextendedproperty
'MS_Description', N'来源库区'
GO

EXEC sp_addextendedproperty
'MS_Description', N'来源库区编码'
GO

EXEC sp_addextendedproperty
'MS_Description', N'来源库区名称'
GO

EXEC sp_addextendedproperty
'MS_Description', N'来源库位'
GO

EXEC sp_addextendedproperty
'MS_Description', N'来源库位编码'
GO

EXEC sp_addextendedproperty
'MS_Description', N'来源库位描述'
GO

EXEC sp_addextendedproperty
'MS_Description', N'来源仓库分类（字典项-->warehouse_category）'
GO

EXEC sp_addextendedproperty
'MS_Description', N'来源仓库属性（字典项-->warehouse_property，-1-不合格 0-待验 1-合格）'
GO

EXEC sp_addextendedproperty
'MS_Description', N'目的仓库'
GO

EXEC sp_addextendedproperty
'MS_Description', N'目的仓库编码'
GO

EXEC sp_addextendedproperty
'MS_Description', N'目的仓库名称'
GO

EXEC sp_addextendedproperty
'MS_Description', N'目的库区'
GO

EXEC sp_addextendedproperty
'MS_Description', N'目的库区编码'
GO

EXEC sp_addextendedproperty
'MS_Description', N'目的库区名称'
GO

EXEC sp_addextendedproperty
'MS_Description', N'目的库位'
GO

EXEC sp_addextendedproperty
'MS_Description', N'目的库位编码'
GO

EXEC sp_addextendedproperty
'MS_Description', N'目的库位描述'
GO

EXEC sp_addextendedproperty
'MS_Description', N'目的仓库分类（字典项-->warehouse_category）'
GO

EXEC sp_addextendedproperty
'MS_Description', N'目的仓库属性（字典项-->warehouse_property，-1-不合格 0-待验 1-合格）'
GO

EXEC sp_addextendedproperty
'MS_Description', N'出入库类型(字典项-->warehouse_inout，0-其它 1-入库 2-出库)'
GO

EXEC sp_addextendedproperty
'MS_Description', N'商品信息'
GO

EXEC sp_addextendedproperty
'MS_Description', N'商品分类'
GO

EXEC sp_addextendedproperty
'MS_Description', N'商品编号'
GO

EXEC sp_addextendedproperty
'MS_Description', N'商品名称'
GO

EXEC sp_addextendedproperty
'MS_Description', N'商品规格'
GO

EXEC sp_addextendedproperty
'MS_Description', N'商品型号'
GO

EXEC sp_addextendedproperty
'MS_Description', N'商品单位'
GO

EXEC sp_addextendedproperty
'MS_Description', N'商品批号'
GO

EXEC sp_addextendedproperty
'MS_Description', N'商品条码'
GO

EXEC sp_addextendedproperty
'MS_Description', N'库存数量'
GO

EXEC sp_addextendedproperty
'MS_Description', N'来源单号'
GO

EXEC sp_addextendedproperty
'MS_Description', N'业务单号'
GO

EXEC sp_addextendedproperty
'MS_Description', N'业务类型（字典项-->warehouse_business_type）'
GO

EXEC sp_addextendedproperty
'MS_Description', N'备注'
GO

EXEC sp_addextendedproperty
'MS_Description', N'创建者'
GO

EXEC sp_addextendedproperty
'MS_Description', N'创建者姓名'
GO

EXEC sp_addextendedproperty
'MS_Description', N'创建时间'
GO

EXEC sp_addextendedproperty
'MS_Description', N'更新者'
GO

EXEC sp_addextendedproperty
'MS_Description', N'更新者姓名'
GO

EXEC sp_addextendedproperty
'MS_Description', N'更新时间'
GO

EXEC sp_addextendedproperty
'MS_Description', N'库存日志'
GO


-- ----------------------------
-- Records of t_wms_stock_log
-- ----------------------------

-- ----------------------------
-- Table structure for t_wms_warehouse_area
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[autumn-mall].[t_wms_warehouse_area]') AND type IN ('U'))
	DROP TABLE [autumn-mall].[t_wms_warehouse_area]
GO

CREATE TABLE [t_wms_warehouse_area] (
  [id] nvarchar(64) NOT NULL,
  [warehouse_category] nvarchar(10) NOT NULL,
  [warehouse_info_id] nvarchar(64) NOT NULL,
  [warehouse_info_code] nvarchar(50) NOT NULL,
  [warehouse_info_name] nvarchar(100) NOT NULL,
  [property] nvarchar(10) NOT NULL,
  [code] nvarchar(50) NOT NULL,
  [name] nvarchar(100) NOT NULL,
  [is_enable] int NOT NULL,
  [is_delete] int NOT NULL,
  [remark] nvarchar(max) NULL,
  [create_by] nvarchar(64) NOT NULL,
  [create_name] nvarchar(50) NOT NULL,
  [create_time] datetime2(0) NOT NULL,
  [update_by] nvarchar(64) NULL,
  [update_name] nvarchar(50) NULL,
  [update_time] datetime2(0) NULL
)
GO

EXEC sp_addextendedproperty
'MS_Description', N'主键'
GO

EXEC sp_addextendedproperty
'MS_Description', N'仓库分类（字典项-->warehouse_category）'
GO

EXEC sp_addextendedproperty
'MS_Description', N'所属仓库'
GO

EXEC sp_addextendedproperty
'MS_Description', N'仓库编码'
GO

EXEC sp_addextendedproperty
'MS_Description', N'仓库名称'
GO

EXEC sp_addextendedproperty
'MS_Description', N'仓库属性（字典项-->warehouse_property，-1-不合格 0-待验 1-合格）'
GO

EXEC sp_addextendedproperty
'MS_Description', N'库区编码'
GO

EXEC sp_addextendedproperty
'MS_Description', N'库区描述'
GO

EXEC sp_addextendedproperty
'MS_Description', N'是否启用(0-否 1-是)'
GO

EXEC sp_addextendedproperty
'MS_Description', N'删除标识(0-否 1-是)'
GO

EXEC sp_addextendedproperty
'MS_Description', N'备注'
GO

EXEC sp_addextendedproperty
'MS_Description', N'创建者'
GO

EXEC sp_addextendedproperty
'MS_Description', N'创建者姓名'
GO

EXEC sp_addextendedproperty
'MS_Description', N'创建时间'
GO

EXEC sp_addextendedproperty
'MS_Description', N'更新者'
GO

EXEC sp_addextendedproperty
'MS_Description', N'更新者姓名'
GO

EXEC sp_addextendedproperty
'MS_Description', N'更新时间'
GO

EXEC sp_addextendedproperty
'MS_Description', N'库区信息'
GO


-- ----------------------------
-- Records of t_wms_warehouse_area
-- ----------------------------

-- ----------------------------
-- Table structure for t_wms_warehouse_info
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[autumn-mall].[t_wms_warehouse_info]') AND type IN ('U'))
	DROP TABLE [autumn-mall].[t_wms_warehouse_info]
GO

CREATE TABLE [t_wms_warehouse_info] (
  [id] nvarchar(64) NOT NULL,
  [category] nvarchar(10) NOT NULL,
  [code] nvarchar(50) NOT NULL,
  [name] nvarchar(100) NOT NULL,
  [is_enable] int NOT NULL,
  [is_delete] int NOT NULL,
  [remark] nvarchar(max) NULL,
  [create_by] nvarchar(64) NOT NULL,
  [create_name] nvarchar(50) NOT NULL,
  [create_time] datetime2(0) NOT NULL,
  [update_by] nvarchar(64) NULL,
  [update_name] nvarchar(50) NULL,
  [update_time] datetime2(0) NULL
)
GO

EXEC sp_addextendedproperty
'MS_Description', N'主键'
GO

EXEC sp_addextendedproperty
'MS_Description', N'仓库分类（字典项-->warehouse_category）'
GO

EXEC sp_addextendedproperty
'MS_Description', N'仓库编码'
GO

EXEC sp_addextendedproperty
'MS_Description', N'仓库描述'
GO

EXEC sp_addextendedproperty
'MS_Description', N'是否启用(0-否 1-是)'
GO

EXEC sp_addextendedproperty
'MS_Description', N'删除标识(0-否 1-是)'
GO

EXEC sp_addextendedproperty
'MS_Description', N'备注'
GO

EXEC sp_addextendedproperty
'MS_Description', N'创建者'
GO

EXEC sp_addextendedproperty
'MS_Description', N'创建者姓名'
GO

EXEC sp_addextendedproperty
'MS_Description', N'创建时间'
GO

EXEC sp_addextendedproperty
'MS_Description', N'更新者'
GO

EXEC sp_addextendedproperty
'MS_Description', N'更新者姓名'
GO

EXEC sp_addextendedproperty
'MS_Description', N'更新时间'
GO

EXEC sp_addextendedproperty
'MS_Description', N'仓库信息'
GO


-- ----------------------------
-- Records of t_wms_warehouse_info
-- ----------------------------

-- ----------------------------
-- Table structure for t_wms_warehouse_location
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[autumn-mall].[t_wms_warehouse_location]') AND type IN ('U'))
	DROP TABLE [autumn-mall].[t_wms_warehouse_location]
GO

CREATE TABLE [t_wms_warehouse_location] (
  [id] nvarchar(64) NOT NULL,
  [warehouse_category] nvarchar(10) NOT NULL,
  [warehouse_property] nvarchar(10) NOT NULL,
  [warehouse_info_id] nvarchar(64) NOT NULL,
  [warehouse_info_code] nvarchar(50) NOT NULL,
  [warehouse_info_name] nvarchar(100) NOT NULL,
  [warehouse_area_id] nvarchar(64) NOT NULL,
  [warehouse_area_code] nvarchar(50) NOT NULL,
  [warehouse_area_name] nvarchar(100) NOT NULL,
  [code] nvarchar(50) NOT NULL,
  [name] nvarchar(100) NOT NULL,
  [is_enable] int NOT NULL,
  [is_delete] int NOT NULL,
  [remark] nvarchar(max) NULL,
  [create_by] nvarchar(64) NOT NULL,
  [create_name] nvarchar(50) NOT NULL,
  [create_time] datetime2(0) NOT NULL,
  [update_by] nvarchar(64) NULL,
  [update_name] nvarchar(50) NULL,
  [update_time] datetime2(0) NULL
)
GO

EXEC sp_addextendedproperty
'MS_Description', N'主键'
GO

EXEC sp_addextendedproperty
'MS_Description', N'仓库分类（字典项-->warehouse_category）'
GO

EXEC sp_addextendedproperty
'MS_Description', N'仓库属性（字典项-->warehouse_property，-1-不合格 0-待验 1-合格）'
GO

EXEC sp_addextendedproperty
'MS_Description', N'所属仓库'
GO

EXEC sp_addextendedproperty
'MS_Description', N'仓库编码'
GO

EXEC sp_addextendedproperty
'MS_Description', N'仓库名称'
GO

EXEC sp_addextendedproperty
'MS_Description', N'所属库区'
GO

EXEC sp_addextendedproperty
'MS_Description', N'库区编码'
GO

EXEC sp_addextendedproperty
'MS_Description', N'库区名称'
GO

EXEC sp_addextendedproperty
'MS_Description', N'库位编码'
GO

EXEC sp_addextendedproperty
'MS_Description', N'库位描述'
GO

EXEC sp_addextendedproperty
'MS_Description', N'是否启用(0-否 1-是)'
GO

EXEC sp_addextendedproperty
'MS_Description', N'删除标识(0-否 1-是)'
GO

EXEC sp_addextendedproperty
'MS_Description', N'备注'
GO

EXEC sp_addextendedproperty
'MS_Description', N'创建者'
GO

EXEC sp_addextendedproperty
'MS_Description', N'创建者姓名'
GO

EXEC sp_addextendedproperty
'MS_Description', N'创建时间'
GO

EXEC sp_addextendedproperty
'MS_Description', N'更新者'
GO

EXEC sp_addextendedproperty
'MS_Description', N'更新者姓名'
GO

EXEC sp_addextendedproperty
'MS_Description', N'更新时间'
GO

EXEC sp_addextendedproperty
'MS_Description', N'库位信息'
GO


-- ----------------------------
-- Records of t_wms_warehouse_location
-- ----------------------------

-- ----------------------------
-- Indexes structure for table t_meta_per_unit
-- ----------------------------
CREATE UNIQUE NONCLUSTERED INDEX [UK_PRODUCT_CATEGORY_01]
ON [].[t_meta_per_unit] (
  [code]
)
GO


-- ----------------------------
-- Primary Key structure for table t_meta_per_unit
-- ----------------------------
ALTER TABLE [t_meta_per_unit] ADD PRIMARY KEY CLUSTERED ([id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
GO


-- ----------------------------
-- Indexes structure for table t_meta_product_category
-- ----------------------------
CREATE UNIQUE NONCLUSTERED INDEX [UK_PRODUCT_CATEGORY_01]
ON [].[t_meta_product_category] (
  [code]
)
GO


-- ----------------------------
-- Primary Key structure for table t_meta_product_category
-- ----------------------------
ALTER TABLE [t_meta_product_category] ADD PRIMARY KEY CLUSTERED ([id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
GO


-- ----------------------------
-- Indexes structure for table t_meta_product_info
-- ----------------------------
CREATE UNIQUE NONCLUSTERED INDEX [UK_RPODUCT_INFO_01]
ON [].[t_meta_product_info] (
  [code]
)
GO


-- ----------------------------
-- Primary Key structure for table t_meta_product_info
-- ----------------------------
ALTER TABLE [t_meta_product_info] ADD PRIMARY KEY CLUSTERED ([id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
GO


-- ----------------------------
-- Indexes structure for table t_sale_sale_order
-- ----------------------------
CREATE UNIQUE NONCLUSTERED INDEX [UK_WAREHOUSE_STOCK_01]
ON [].[t_sale_sale_order] (
  [order_no]
)
GO


-- ----------------------------
-- Primary Key structure for table t_sale_sale_order
-- ----------------------------
ALTER TABLE [t_sale_sale_order] ADD PRIMARY KEY CLUSTERED ([id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
GO


-- ----------------------------
-- Indexes structure for table t_sale_sale_order_dtl
-- ----------------------------
CREATE UNIQUE NONCLUSTERED INDEX [UK_WAREHOUSE_STOCK_DTL_01]
ON [].[t_sale_sale_order_dtl] (
  [sale_order_id],
  [product_id]
)
GO


-- ----------------------------
-- Primary Key structure for table t_sale_sale_order_dtl
-- ----------------------------
ALTER TABLE [t_sale_sale_order_dtl] ADD PRIMARY KEY CLUSTERED ([id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
GO


-- ----------------------------
-- Indexes structure for table t_wms_stock
-- ----------------------------
CREATE UNIQUE NONCLUSTERED INDEX [UK_WAREHOUSE_STOCK_01]
ON [].[t_wms_stock] (
  [warehouse_info_id],
  [warehouse_area_id],
  [warehouse_location_id]
)
GO


-- ----------------------------
-- Primary Key structure for table t_wms_stock
-- ----------------------------
ALTER TABLE [t_wms_stock] ADD PRIMARY KEY CLUSTERED ([id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
GO


-- ----------------------------
-- Indexes structure for table t_wms_stock_dtl
-- ----------------------------
CREATE UNIQUE NONCLUSTERED INDEX [UK_WAREHOUSE_STOCK_DTL_01]
ON [].[t_wms_stock_dtl] (
  [warehouse_stock_id],
  [product_id],
  [sn_no]
)
GO


-- ----------------------------
-- Primary Key structure for table t_wms_stock_dtl
-- ----------------------------
ALTER TABLE [t_wms_stock_dtl] ADD PRIMARY KEY CLUSTERED ([id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
GO


-- ----------------------------
-- Primary Key structure for table t_wms_stock_log
-- ----------------------------
ALTER TABLE [t_wms_stock_log] ADD PRIMARY KEY CLUSTERED ([id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
GO


-- ----------------------------
-- Indexes structure for table t_wms_warehouse_area
-- ----------------------------
CREATE UNIQUE NONCLUSTERED INDEX [UK_WAREHOUSE_AREA_01]
ON [].[t_wms_warehouse_area] (
  [warehouse_info_id],
  [code]
)
GO


-- ----------------------------
-- Primary Key structure for table t_wms_warehouse_area
-- ----------------------------
ALTER TABLE [t_wms_warehouse_area] ADD PRIMARY KEY CLUSTERED ([id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
GO


-- ----------------------------
-- Indexes structure for table t_wms_warehouse_info
-- ----------------------------
CREATE UNIQUE NONCLUSTERED INDEX [UK_WAREHOUSE_INFO_01]
ON [].[t_wms_warehouse_info] (
  [code]
)
GO


-- ----------------------------
-- Primary Key structure for table t_wms_warehouse_info
-- ----------------------------
ALTER TABLE [t_wms_warehouse_info] ADD PRIMARY KEY CLUSTERED ([id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
GO


-- ----------------------------
-- Indexes structure for table t_wms_warehouse_location
-- ----------------------------
CREATE UNIQUE NONCLUSTERED INDEX [UK_WAREHOUSE_LOCATION_01]
ON [].[t_wms_warehouse_location] (
  [warehouse_info_id],
  [warehouse_area_id],
  [code]
)
GO


-- ----------------------------
-- Primary Key structure for table t_wms_warehouse_location
-- ----------------------------
ALTER TABLE [t_wms_warehouse_location] ADD PRIMARY KEY CLUSTERED ([id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
GO

